﻿dynamic class My3D.Point3D {
	public var x:Number;
	public var y:Number;
	public var z:Number;
	//Point x value after project
	public var X:Number;
	//Point y value after project
	public var Y:Number;
	//Point z value after project
	public var Z:Number;
	
	public function Mol():Number {
		return Math.sqrt(x * x + y * y + z * z);
	}
	
	
	public function Point3D(xx:Number,yy:Number,zz:Number) {
		xx = ((xx == undefined)? 0:xx);
		yy = ((yy == undefined)? 0:yy);
		zz = ((zz == undefined)? 0:zz);
		this.X=this.x = xx;
		this.Y=this.y = yy;
		this.Z=this.z = zz;
	}
	
	public function clone():Point3D {
		var p:Point3D = new Point3D(this.x, this.y, this.z);
		p.U = this.U;
		p.V = this.V;
		return p;
	}
	public function normalize():Void
	{
		var mod:Number = this.Mol();

		if( mod != 0 && mod != 1)
		{
			this.x /= mod;
			this.y /= mod;
			this.z /= mod;
		}
	}
	
	
	
	
	public function toString() {
		return "(" + x + "," + y + "," + z + ")";
	}
}